<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>常规促销取消申请明细</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">  <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <link href="__STATIC__/layout/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
     <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/demo/webuploader-demo.css">
    <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>
        .radio-inline input[type=radio] {
            margin-top: 4px
        }
    </style>
</head>

<body style="color:#333;padding:3px;" class="x_sorll">
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">常规促销取消申请明细</h2>
    </div>
    <!-- 标题 -->
    <div >
    <form id="f1" class="form-inline">
    <input type="hidden" name="aid" value="{$aid}"/>
      <table class="table row-margin-top table-bordered bud_hei">
          <tr>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >主题</label></td>
             <td colspan="7" class="font-bold">{$apply.title}</td>
          </tr>
          <tr>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >编号</label></td>
             <td>{$apply.no}</td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >原申请编号</label></td>
             <td>{if condition="$apply.yuanno neq ''"}{$apply.yuanno}{else/}无 {/if}</td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >修改后编号</label></td>
              <td>{if condition="$apply.nextno neq ''"}{$apply.nextno}{else/}无 {/if}</td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >状态</label></td>
             <td>{$apply.zhuangtai}</td>
          </tr>
           <tr>
          	 <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >申请时间</label></td>
             <td>{$apply.created_on}</td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >申请人</label></td>
             <td><a href="javascript:;">{$apply.cname}({$apply.job_name})</a></td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label" >申请人部门</label></td>
             <td colspan="3">{$apply.de_name}</td>
             
             
          </tr>
          
      </table>
       <table class="table row-margin-top table-bordered text-center bud_hei" id="tb">
         <thead>
          <tr class="info">
             <th class="text-center" rowspan="2">状态</th>
             <th class="text-center" rowspan="2">审批人</th>
             <th class="text-center" rowspan="2">序号</th>
            <th class="text-center"  rowspan="2">明细编号</th>
            <th class="text-center" colspan="2">供货商信息</th>
             <th class="text-center" colspan="11" >活动信息详情</th>
             <th class="text-center" colspan="8" >费用详情</th>
             <th class="text-center" colspan="6" >销量详情</th>
             <th class="text-center" rowspan="2">项目描述</th>
             <th class="text-center" rowspan="2">备注</th>
          
              <th class="text-center" rowspan="2">取消原因<span class="colorRed">*</span><br>
              <span class="colorRed">(要取消的促销必须填原因，不填原因视为不取消！)</span><input type="button" class="btn btn-danger" id="cancelall" value="取消整单"/>
            </th>
          </tr>

            <tr class="info">
            <th class="text-center">供应商编号</th>
             <th class="text-center">供应商名称</th>
            <th class="text-center">分区</th>
            <th class="text-center">省份</th>
            <th class="text-center">城市</th>
            <th class="text-center">经销商</th>
            <th class="text-center">系统</th>
            <th class="text-center">网点</th>
            <th class="text-center">品牌</th>
            <th class="text-center">品类</th>
            <th class="text-center">系列</th>
             <th class="text-center">活动<br/>执行时间</th>
            <th class="text-center">预计核销时间</th>
             <th class="text-center">二级费用科目</th>
             <th class="text-center">三级费用科目</th>
             <th class="text-center">未税投入</th>
             <th class="text-center">税率</th>
             <th class="text-center">是否增值税<br/>（可抵扣）</th>
             <th class="text-center">含税投入</th>
             <th class="text-center">实际投入</th>
             <th class="text-center">费用支付方式</th>
             <th class="text-center">预计销量</th>
             <th class="text-center">预计费用率</th>
             <th class="text-center">2SR基准销量</th>
             <th class="text-center">基准销量</th>
             <th class="text-center">新增销量</th>
             <th class="text-center">预计ROI</th>
             </tr>
         </thead>
		{volist name="applyde" id="vo1" key="j"}
         <tr class="text-left" {if condition="$vo1.tag eq 1"} style="color:green;" {/if}>
                  <input type="hidden" name="did[]" value="{$vo1.id}"/>
          <td>
                    {switch name="$vo1.tag" }
                         {case value="0"}
                          正常
                        {/case}
                         {case value="1"}
                          异动
                        {/case}
                         {case value="2"}
                          取消
                        {/case}
                    {/switch}
                  </td><td>无</td><td>{$j}</td>  
                  <td> {$vo1.no}-{$vo1.detail_no}<a href="{:url('mingxijuece')}?did={$vo1.id}" title="决策依据" class="J_menuItem" ><span style="display: none;">决策依据</span><span class="glyphicon glyphicon-zoom-in fangda" aria-hidden="true" style="display: inline-block;"></span></a></td>
                  <td class='text-center'>{$vo1.gys_no}</td>
                  <td>{$vo1.gys_name}</td>
                  <td class='text-center'>{$vo1.fenqu}</td>
                  <td class='text-center'>{$vo1.sheng}</td>
                  <td class='text-center'>{$vo1.shi}</td>
				  <td class='text-center'>{$vo1.jxs}</td>
				  <td class='text-center'>{$vo1.system}</td>
				  <td class='text-center'>{$vo1.net}</td>
				  <td class='text-center'>{$vo1.brand}</td>
				  <td class='text-center'>{$vo1.category}</td>
				  <td class='text-center'>{$vo1.series}</td>
				  <td>{$vo1.start_time}<br/>{$vo1.end_time}</td>
                 
                  <td>{$vo1.hexiao_time}</td>
                  <td class='text-center'>{$vo1.kemu2}</td>
				  <td class='text-center'>{$vo1.kemu3}</td>
				  <td class='text-right num2 pifu'>{$vo1.pifuzonge}</td>
				 
				 <td ><span class="num2">{$vo1.shuilv}</span>%</td>
				  
                     <td class="text-center">
                      {if condition="$vo1.dikou eq 1"} 是{else/}否{/if}
                     </td>
                  <td class="text-right"><span class="num2 hanshui">{$vo1.hanshui}</span></td>
                  <td class="text-right"><span class="num2 hs">{$vo1.hanshui}</span></td>
                   <td>
                          支付方式
                      </td>
                     <td class='text-right num2 yujixiao'>{$vo1.zong_xiaoliang}</td><td><span class="num2">{$vo1.yujifeiyonglv}</span>%</td><td class='text-right num2'>0</td>
                      <td class='text-right num2 jizhunxiao'>{$vo1.jizhun_xiaoliang}</td> <td class='text-right num2 xinxiao'>{$vo1.xinxiaoliang}</td>
                      <td><span class="num2">{$vo1.yujiroi}</span>%</td>
                       <td><a onclick="tanchuan({$vo1.id})">点击查看</a></td><td>{$vo1.remark}</td>
                        <td><input type="text" class="form-control quxiaoyuanyin"  name="quxiaoyuanyin[]"></td>

        </tr>
     {/volist}
        <tr class="text-right font-bold">
          <td colspan="11" >合计</td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
         
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <td class="pifuzong"></td>
         
           <td></td>
          <td></td>
          <td class="hanshuizong"></td>
          <td class="hanshuizong"></td>
          <td></td>
          <td class="yujixiaozong"></td>
          <td></td>
          <td></td>
          <td class="jizhunxiaozong"></td>
          <td class="xinxiaozong"></td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
      </table>
       </table>
         <table class="table table-bordered" style="margin:0;padding: 0">
          <tr>
            <td class="font-bold">本申请中包含<span>{$contfenqu}</span>个分区，{$contbrand}个品牌,{$contgys}个供应商,{$contfeiyong}个三级费用科目  
			其中{volist name="feiyongs" id="fys"}{$fys.title}:<span class="num2">{$fys.kezonge}</span>（元）&nbsp;&nbsp; {/volist}
			总预计未税费用:<span class="pifuzong"></span>  （元）&nbsp;&nbsp;      总预计销售量：<span class="yujixiaozong"></span>（元）
            </td>
          </tr>
      </table>
         <div class="form-group white-bg" style="margin:20px 10px 20px 20px;">
            <div id="uploader" class="wu-example">
                <!--用来存放文件信息-->
                <div id="thelist" class="uploader-list">
                    {volist name="fujian" id="fo"}
                        <h4>{$fo.file_name}</h4>
                   {/volist}
                </div>
                <div class="btns">
                    <div id="picker">选择文件</div>
                    <button id="ctlBtn" class="btn btn-default">开始上传</button>
                </div>
                <input type="hidden" name="attach" id="attach" value="{$apply.fujian}" >
            </div>
            <span>注：最多上传15个文件，每个文件小于50M,支持格式：</span><br>jpg,bnp,gif,png,jpeg,tif,raw,doc,docx,xls,xlsx,ppt,pptx,txt,pdf,rar,zip,mp4,avi,rmvb,rm,mid,3gp,AVI,3GP,,mpg,mp3,wma,wav
        </div>
           <table class="table table-bordered text-left bud_hei">
            <tr class="info">
                <th class="text-left font-bold">审批意见</th>
            </tr>
            {volist name="logs" id="l"}
          <tr>
              <td>{$l.USERNAME} 审批动作：{$l.MEMO}；审批意见：{if $l.COMMENTS}{$l.COMMENTS}{else/}无{/if}(审批时间：{$l.ACTIONTIME})</td>
          </tr>
          
          {/volist}
      </table>
         <div class="row sub_btn" style="width:100%;text-align:center;padding: 20px 0">
        <input type="hidden" id="nodeKey" name="nodeKey"/>
                  <input type="hidden" id="selectId" name="selectId"/>
                  <input type="hidden" id="selectName" name="selectName"/>
                    {volist name="btn.nextNodes" id="b"}
                      {if $b.nodeName=='结束'}
                      <input type="button" class="btn-danger btn" onclick="zuofei('{$b.nodeKey}','{$b.selectId}','{$b.selectName}')" value="点此作废"/>
                      {else/}
                      <input type="button" class="btn-info btn" onclick="baocun('{$b.nodeKey}','{$b.selectId}','{$b.selectName}')" value="保存并提交工作流"/>
                      {/if}
                    {/volist}
    </div>
</form>
    </div>
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
   <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
     <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
         <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="__STATIC__/layout/js/plugins/summernote/summernote.min.js"></script>
<script src="__STATIC__/layout/js/plugins/summernote/summernote-zh-CN.js"></script>
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
 <script src="__STATIC__/layout/js/common.js"></script>
  <script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script><script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script>
        var fr={$from};
             function baocun(nodeKey,selectId,selectName){
  $("#nodeKey").val(nodeKey)
  $("#selectId").val(selectId)
  $("#selectName").val(selectName)
   $.ajax({
          cache: true,
          type: "POST",
          url:"{:url('qxbaocunchuli')}",
          data:$('#f1').serialize(),// 你的formid
          async: false,
          error: function(request) {
            alert("Connection error");
          },
          success: function(data) {
            //alert(data);
            //var res=JSON.parse(data);
                    var res1=JSON.parse(data);
                            if(res1["state"]==1){
                              swal({
                                title: "完成",
                                text: "操作已成功",
                                type: "success"
                                },function(){
                                  if(fr==1)
                                        location.href="{:url('index')}"
                                  else
                                        location.href="{:url('Workflowdb/index')}"
                                });

                          }else{
                            swal({
                            title: "错误",
                            text:  res1["msg"],
                            type: "warning"
                            });
                          }          
          }
        });
}
           function zuofei(nodeKey,selectId,selectName){
  $("#nodeKey").val(nodeKey)
  $("#selectId").val(selectId)
  $("#selectName").val(selectName)
   $.ajax({
          cache: true,
          type: "POST",
          url:"{:url('qxzuofeichuli')}",
          data:$('#f1').serialize(),// 你的formid
          async: false,
          error: function(request) {
            alert("Connection error");
          },
          success: function(data) {
           // alert(data);
            //var res=JSON.parse(data);
                    var res1=JSON.parse(data);
                            if(res1["state"]==1){
                              swal({
                                title: "完成",
                                text: "操作已成功",
                                type: "success"
                                },function(){
                                   if(fr==1)
                                        location.href="{:url('index')}"
                                    else
                                        location.href="{:url('Workflowdb/index')}"
                                  //parent.layer.close(parent.layer.getFrameIndex(window.name))
                                  //
                                });

                          }else{
                            swal({
                            title: "错误",
                            text:  res1["msg"],
                            type: "warning"
                            });
                          }         
          }
        });
}
  
</script>
     <!-- Web Uploader -->
<script type="text/javascript">
    // 添加全局站点信息
    var BASE_URL = '__STATIC__/layout/js/plugins/webuploader';
</script>
<script src="__STATIC__/layout/js/plugins/webuploader/webuploader.min.js"></script>
    <script>
    $(function(){
    	hesuanyuan();yidonghouhs();xinxiaohs();jizhunxiaohs();yujixiaohs();
    })
//核算新销量
function xinxiaohs(){
   var num=0;
 $(".xinxiao").each(function(){
    if($(this).html()!=""){
      num+=parseFloat($(this).html());
    }
   // alert(num);
  })
 $(".xinxiaozong").html(num.toFixed(2));

}
//核算基准销量
function jizhunxiaohs(){
   var num=0;
 $(".jizhunxiao").each(function(){
    if($(this).html()!=""){
      num+=parseFloat($(this).html());
    }
   // alert(num);
  })
 $(".jizhunxiaozong").html(num.toFixed(2));

}
//核算预计销量
function yujixiaohs(){
   var num=0;
 $(".yujixiao").each(function(){
    if($(this).html()!=""){
      num+=parseFloat($(this).html());
    }
   // alert(num);
  })
 $(".yujixiaozong").html(num.toFixed(2));

}
//核算含税
function yidonghouhs(){
   var num=0;
 $(".hanshui").each(function(){
    if($(this).html()!=""){
      num+=parseFloat($(this).html());
    }
   // alert(num);
  })
 $(".hanshuizong").html(num.toFixed(2));

}
    //核算未税费用
function hesuanyuan(){
   var num=0;
 $(".pifu").each(function(){
    if($(this).html()!=""){
      num+=parseFloat($(this).html());
    }
   // alert(num);
  })
 $(".pifuzong").html(num.toFixed(2));

}
   
    //取消整单
       $("#cancelall").click(function(){
           var str = '<form method="get" class="form-inline" style="margin:10px"><table class="table-bordered table"><tr><th class="info text-center" colspan="2">取消整单</th></tr><tr><td style="min-width:140px;width:140px;" class="text-center">取消原因</td><td><input type="text" id="quxiaoall" class="form-control"/><span id="cuowuqx" style="display:none;color:red;">原因不能为空</span></td></tr></table> <div class="row sub_btn" style="width:100%;text-align:center;padding: 20px 0"><input type="button" class="btn btn-success" id="qdqx" value="确定"><input type="button" class="btn btn-warning" value="返回" id="cancelBack" style="margin-left:20px"></div></form>'
            layer.open({
              type: 1,
              title:"取消整单",
              skin: 'layui-layer-rim', //加上边框
              area: ['500px', '300px'], //宽高
              content: str
            });
              var cancelBack = document.getElementById('cancelBack')
              cancelBack.onclick = function(){
               layer.closeAll(); 
               }
                var qdqx = document.getElementById('qdqx')
              qdqx.onclick = function(){
              	if($("#quxiaoall").val()==""){
 					$("#cuowuqx").show();
              	}else{
              		//alert(1);
              		$("#cuowuqx").hide();
              			$(".quxiaoyuanyin").val($("#quxiaoall").val());
               			layer.closeAll(); 
              	}
              
               }
        })
           $(document).ready(function(){
           	 
          		
             $(".num2").each(function(){
                if(!isNaN(parseFloat($(this).html())))
                 var num=parseFloat($(this).html()).toFixed(2);
                else
                    var num="0.00";
                $(this).html(num);
            })
              $(".num2i").each(function(){
                if(!isNaN(parseFloat($(this).val())))
                 var num=parseFloat($(this).val()).toFixed(2);
                else
                    var num="0.00";
                $(this).val(num);
            })
 
		});
      

       // 文件上传
    jQuery(function() {
        var $ = jQuery,
            $list = $('#thelist'),
            $btn = $('#ctlBtn'),
            state = 'pending',
            uploader;

        var ids = [{if $apply.fujian}value='{$apply.fujian}' {/if}];
        uploader = WebUploader.create({

            // 不压缩image
            resize: false,

            // swf文件路径
            swf: BASE_URL + '/js/Uploader.swf',

            // 文件接收服务端。
            server: '{:url("upload/fileupload")}',

            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '#picker'
        });

        // 当有文件添加进来的时候
        uploader.on( 'fileQueued', function( file ) {
            $list.append( '<div id="' + file.id + '" class="item">' +
                '<h4 class="info">' + file.name + '</h4>' +
                '<p class="state">等待上传...</p>' +
                '</div>' );
        });

        // 文件上传过程中创建进度条实时显示。
        uploader.on( 'uploadProgress', function( file, percentage ) {
            var $li = $( '#'+file.id ),
                $percent = $li.find('.progress .progress-bar');

            // 避免重复创建
            if ( !$percent.length ) {
                $percent = $('<div class="progress progress-striped active">' +
                    '<div class="progress-bar" role="progressbar" style="width: 0%">' +
                    '</div>' +
                    '</div>').appendTo( $li ).find('.progress-bar');
            }

            $li.find('p.state').text('上传中');

            $percent.css( 'width', percentage * 100 + '%' );
        });

        uploader.on( 'uploadSuccess', function( file,response) {
            if(response.success)
                ids.push(response.id)
            $( '#'+file.id ).find('p.state').text(response.msg);
        });

        uploader.on( 'uploadError', function( file ) {
            $( '#'+file.id ).find('p.state').text('上传出错');
        });

        uploader.on( 'uploadComplete', function( file ) {
            $('#attach').val(ids.join(','))
            $( '#'+file.id ).find('.progress').fadeOut();
        });

        uploader.on( 'all', function( type ) {
            if ( type === 'startUpload' ) {
                state = 'uploading';
            } else if ( type === 'stopUpload' ) {
                state = 'paused';
            } else if ( type === 'uploadFinished' ) {
                state = 'done';
            }

            if ( state === 'uploading' ) {
                $btn.text('暂停上传');
            } else {
                $btn.text('开始上传');
            }
        });

        $btn.on( 'click', function() {
            if ( state === 'uploading' ) {
                uploader.stop();
            } else {
                uploader.upload();
            }
            return false
        });

       
    });
  
    </script>
</body>

</html>
